<template>
  <div class="add-btn-wrap" @click="addFun">
    <div class="avator-box">
      <div :style="{'width': size + 'px', 'height': size + 'px'}" class="add-btn" @click="addFun">
        <img :src="isRequire===1?addRequire:addIcon" class="add-icon">
      </div>
    </div>
    <span v-if="showRelation" class="name">
      <span v-if="relation === 1">+</span>
      <span v-if="relation === 0" style="font-size:14px">/</span>
    </span>
  </div>
</template>
<script>
import addIcon from '@/assets/auditor_add_btn.png';
import addRequire from '@/assets/add_require.png';
export default {
  name: 'AddBtn',
  props: {
    size: {
      type: Number,
      default: 40
    },
    relation: {
      type: Number,
      default: -1
    },
    showRelation: {
      type: Boolean,
      default: false
    },
    isRequire: {
      type: Number,
      default: 0
    }
  },
  data() {
    return {
      addIcon,
      addRequire
    };
  },
  methods: {
    addFun() {
      this.$emit('add');
    }
  }
};
</script>
<style lang="scss" scoped>
.add-btn {
  cursor: pointer;
  .add-icon {
    width: 100%;
    height: 100%;
  }
}
.add-btn-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  .name {
    font-size: 20px;
    color: #999999;
  }
}
</style>
